<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title>myteam</title>
	<link rel="stylesheet" type="text/css" href="../../css/aui.css" />
	<link rel="stylesheet" type="text/css" href="./css/my.css" />
</head>

<body>
	<div class="referee_box">
		<div class="referee_text">
			您的推荐人
		</div>
		<div class="referee_info">
			<img src="./image/default_avatar.png" id="myavatar">
			<div class="referee_name" style="margin-top:18px;">
				<text id="myusername">
					优券联盟
					</text>
				<text id="myusermobile">	</text>
			</div>
		</div>
	</div>
	<div class="myteam">
		<div class="referee_text">
			<img src="./image/team.png">
			<text style="color:#9e56ff">
					我的团队
				</text>
			<!--<div style="float:right;margin-right: 10px;">团队订单</div>-->
		</div>
		<div class="circleBox">
			<div class="circleBox-item_2 leftCircle" tapmode onclick="openWinto('myteamdetail_win','widget://html/coupon_head',{name:'团队明细',url:'widget://html/my/myteamdetail.html',islogin:true})">
				<div class="circleBox-item">
					<div class="circleBox-item_1">
						<div class="contentBox">
							<div class="num" id="myteamtotal">
								0
							</div>
							<div class="name">
								总人数
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="circleBox-item_2">
				<div class="circleBox-item">
					<div class="circleBox-item_1">
						<div class="contentBox">
							<div class="num" id="myteamtotalcount">
								0
							</div>
							<div class="name">
								直属会员
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="details">
			<div class="detailslist">
				<text id="todaycount">
						0
					</text>
				<text>
						今日
					</text>
			</div>
			<div class="detailslist">
				<text id="yesterdaycount">
						0
					</text>
				<text>
						昨日
					</text>
			</div>
			<div class="detailslist">
				<text id="weekcount">
						0
					</text>
				<text>
						本周
					</text>
			</div>
			<div class="detailslist">
				<text id="monthcount">
						0
					</text>
				<text>
						本月
					</text>
			</div>
		</div>
	</div>
	<div class="nav_top ui-row teamlist bottom_bj">
		<ul>
			<li class="active">
				今日新增会员
			</li>
		</ul>
	</div>
	<div class="teaminfo">
		<div class="user-infor-box">
			<div class="user-infor" id="myuserlist">

			</div>
		</div>
	</div>
	<!--加载loading-->
	<div class="index_loading">
		<img src="./image/index_loading.gif" />
		<span>加载中,请稍后...</span>
	</div>
	<!--暂无数据-->
	<div class="temporarily_data" style="display:none;">
		<img src="./image/no_date.png" />
		<span>暂无数据</span>
	</div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/zepto.min.js"></script>
<script type="text/javascript" src="../../script/doT.min.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script id="todaymyuserlist" type="text/x-dot-template">
	{{? it && it.length>0}} {{ for(var i=0, catlen=it.length; i
	<catlen; i++) {}} <div class="top-infor aui-broder-b">
		<div class="left" style="float:left"><img src="{{=it[i].avatar}}" class="user-img" />
			<text class="publicStyleLength nickname nickname_style">
			{{=it[i].realname || it[i].username || it[i].taobao_user_nick || it[i].wxnick || it[i].qqnick||$api.getStorage('appSetInfo').app_name}}
  		</text>
		</div>
		<div class="right fr" style="float: left">
			<text>({{=(it[i].mobile).replace(/^(\d{4})\d{4}(\d+)/,"$1****$2")}})</text>
			<text>时间:{{=formatDate(it[i].reg_time)}}</text>
		</div>
		</div>
		{{}}} {{??}}
		<center><img src="./image/no_date.png" /></center>
		{{?}}
</script>
<script type="text/javascript">
	apiready = function() {
		getMyTeam();
	}
	$(document).ready(function() {});

	function getMyTeam() {
		$('.temporarily_data').hide();
		$(".index_loading").show();
		postDataLogin('getMyTeam', {}, function(ret) {
			console.log(JSON.stringify(ret));
			$(".index_loading").hide();
			$('#myteamtotal').text(ret.myteamcount);
			$('#myteamtotalcount').text(ret.myteamcount);
			$('#todaycount').text(ret.today_myteamcount.length);
			$('#yesterdaycount').text(ret.yesterday_myteamcount);
			$('#weekcount').text(ret.week_myteamcount);
			$('#monthcount').text(ret.month_myteamcount);
			setDotTmpl('todaymyuserlist', 'myuserlist', ret.today_myteamcount);
			if (ret.myupuserinfo) {
				$('.referee_box').show();
				$('#myavatar').attr("src", ret.myupuserinfo.avatar);
				$('#myusername').text(ret.myupuserinfo.realname || ret.myupuserinfo.username || ret.myupuserinfo.taobao_user_nick || ret.myupuserinfo.wxnick || ret.myupuserinfo.qqnick || $api.getStorage('appSetInfo').app_name);
				$('#myusermobile').text((ret.myupuserinfo.mobile).replace(/^(\d{4})\d{4}(\d+)/, "$1****$2"));
			}else{
			$('.referee_box').hide();
			}
		});
	}

	function formatDate(inputTime) {
		var date = new Date(inputTime * 1000);
		var y = date.getFullYear();
		var m = parseInt(date.getMonth() + 1);
		m = m < 10 ? ('0' + m) : m;
		var d = date.getDate();
		d = d < 10 ? ('0' + d) : d;
		var h = date.getHours();
		h = h < 10 ? ('0' + h) : h;
		var minute = date.getMinutes();
		var second = date.getSeconds();
		minute = minute < 10 ? ('0' + minute) : minute;
		second = second < 10 ? ('0' + second) : second;
		var datetime= y + '-' + m + '-' + d + ' ' + h + ':' + minute;
		console.log(datetime);
		return datetime;

	}
</script>

</html>
